package me.szlx.thing.manager;

import me.szlx.thing.Thing;
import me.szlx.thing.bundle.ThingBundle;

import java.util.ArrayList;
import java.util.List;

public class GenericThingManager<T extends Thing> extends AbstractThingManager<T> {
    private List<ThingBundle<T>> bundleList;
    private ThingBundle<T> bundle;

    @Override
    protected ThingBundle<T> getThingBundle() {
        List<ThingBundle<T>> result = new ArrayList<>();
        result.add(bundle);
        if (bundleList != null) {
            result.addAll(bundleList);
        }

        return ThingBundle.combine(result.toArray(new ThingBundle[0]));
    }

    public void setBundleList(List<ThingBundle<T>> bundleList) {
        this.bundleList = bundleList;
    }

    public void setBundle(ThingBundle<T> bundle) {
        this.bundle = bundle;
    }

}
